#ifndef __SENSINGTREE_H__
#define __SENSINGTREE_H__
/* Includes ------------------------------------------------------------------*/
#include "board.h"
#define ST_TX_DATA_SIZE              5
#define ST_RX_DATA_SIZE              37
#define SENSINGTREE_UART_TX_SIZE           (ST_TX_DATA_SIZE*2)
#define SENSINGTREE_UART_RX_SIZE           (ST_RX_DATA_SIZE*2)

#define UART_SENSINGTREE                   Uart1
#define UART_ST_BAUDRATE                      9600

enum Uart_status_e
{
    UART_IDLE = 0,
    UART_JOINED,
    UART_RECEIVE_DONE,
    UART_RECEIVE_WRONG,
    UART_SEND_OUT,
    UART_SEND_WRONG,
    UART_BEGIN_RECEIVE,
    UART_HEADER_CHECKED
};

enum Transfer_ack_type_t
{
    TRANSFER_ACK_OK = 0,
    TRANSFER_ACK_WRONG
};

struct ST_Rx_Buffer_t
{
    uint8_t data[ST_RX_DATA_SIZE];
    uint8_t currentIdx;
};

void ST_Uart_init(void);
void STUart_Irq_Notify(UartNotifyId_t id);

void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc);
void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc);
void Uart_wrong_event(void);
void Open_ST_Uart(void);
void Transfer_ack(enum Transfer_ack_type_t type);
//static void reinitUartReceive(void);

#endif
